#!/bin/bash

set -eo pipefail

: ${GOPATH:?must be set}
GOLANG_VERSION="1.8"
GOLANG_URL="https://golang.org/dl/go1.8.linux-amd64.tar.gz"
GOLANG_SHA256="53ab94104ee3923e228a2cb2116e5e462ad3ebaeea06ff04463479d7f12d27ca"

curl -fsSL -o golang.tar.gz "$GOLANG_URL"
echo "$GOLANG_SHA256  golang.tar.gz" | sha256sum -c -
tar -C /usr/local -xzf golang.tar.gz
rm golang.tar.gz
mkdir -p "$GOPATH"/{src,bin}
chmod -R 777 "$GOPATH"
